#!/bin/ksh
# %Z%%M%        %I%  %W% %G% %U%

    USAGE="Usage: wsm \t[-host    <host name of managing machine>] \
\t\t[-port    <inetd port>] \
\t\t[-profile <pathname of wconsole.pref file>] \
\t\t[-user    <login name>]"

#==============================================================================
usage()
{
     dspmsg websm.cat 10 "$USAGE"
     echo
     exit 1
}


#==============================================================================
# Main
#==============================================================================

hostname=`hostname`
port=9090
profile=""
user=""


while [ $# -gt 0 ]
do
   case $1 in
      -host )
           shift 1
           if [ $# -eq 0 ]
           then
              usage $0
           else
	      hostname=$1
	      host $1 >/dev/null 2>&1 && LANG=C host $1 | read hostname junk
           fi
           ;;
      -port )
           shift 1
           if [ $# -eq 0 ]
           then
              usage $0
           else
              websmargs="$websmargs -Dport=$1"
           fi
           ;;
      -profile )
           shift 1
           if [ $# -eq 0 ]
           then
              usage $0
           else
              profile="-profile $1"
           fi
           ;;
      -lang )
	    shift 1 
	    if [ $# -eq 0 ]
	    then
		usage $0
	    else
		export LANG="$1"
	    fi
	    ;;
      -user )
           shift 1
           if [ $# -eq 0 ]
           then
              usage $0
           else
              user="-user $1"
           fi
           ;;
      -? )
	   usage $0
	   ;;
      * )
	   javaargs="$javaargs $1"
   esac
   shift 1
done


if [ -f /var/websm/config/user_settings/websm.policy ] ; then
   javaargs="$javaargs  -Djava.security.policy=/var/websm/config/user_settings/websm.policy"
else
   javaargs="$javaargs -Djava.security.policy=/usr/websm/config/factory_defaults/websm.policy"
fi



#echo
#echo /usr/websm/bin/wjava $websmargs $javaargs -Dawt.appletWarning=\"Remote class window\" com.ibm.websm.console.WConsole $hostname $profile $user

/usr/websm/bin/wjava $websmargs $javaargs -Dawt.appletWarning="Remote class window" com.ibm.websm.console.WConsole $hostname $profile $user
